from selenium.webdriver.common.by import By

from page_object.pages.BasePage import BasePage


class NewDetailPage(BasePage):
    _iv_praise = (By.ID, 'iv_praise')
    _gift_tv = (By.ID, 'gift_tv')
    _tvSend = (By.ID, 'tvSend')
    _et_chat = (By.ID, 'et_chat')

    def click_good(self):
        self.find(self._iv_praise).click()
        return self

    def send_gift(self, gift_name):
        self.find(self._gift_tv).click()
        self.find_by_xpath(gift_name).click()
        self.find(self._tvSend).click()
        return self

    def comment(self, text):
        self.find(self._et_chat).click()
        self.find(self._et_chat).send_keys(text)
        self.find_by_xpath('发送').click()
        return self

